package epam.bookShelf.actions;

import java.util.HashMap;

public class ActionsPool {
	public static String TEST_ACTION 	= "/testAction.do";
	public static String ADD_BOOK 		= "/addBook.do";
	public static String SEARCH_BOOK 	= "/searchBook.do";
	public static String LOGIN 			= "/login.do";
	public static String LOGOUT			= "/logout.do";
	
	public HashMap<String, Action> actions;
	
	public ActionsPool() {
		actions = new HashMap<String, Action>();
		
		actions.put(TEST_ACTION, 	new TestAction());
		actions.put(ADD_BOOK, 		new AddBook());
		actions.put(SEARCH_BOOK, 	new SearchBook());
		actions.put(LOGIN, 			new LoginAction());
		actions.put(LOGOUT, 		new LogoutAction());
	}
	
	public Action getAction(String name) {
		if (!actions.containsKey(name)) {
			return null;
		} else {
			return actions.get(name);
		}				
	}
}
